// pages/outbreak/outbreak.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
       dataList : [],
       data : '2022-02-17'
    },
    //编写方法获取信息
    getNum( ){
        let that = this;
        let url = "https://interface.sina.cn/news/wap/fymap2020_data.d.json";
        wx.request({
             url : url,
             method:"GET",
             success(response){
                 let info_data = response.data.data;
                 console.log('info_datat',info_data);
                //  创建一个空对象
                let obj = {};
                obj.data = info_data.cachetime
                obj.gnotal = info_data.gntotal;
                obj.econNum = info_data.econNum;
                obj.curetotal = info_data.curetotal;
                obj.deathtotal = info_data.deathtotal;
                obj.asymptomNum = info_data.asymptomNum;
                obj.jwsrNum = info_data.jwsrNum;
                obj.heconNum = info_data.heconNum;
                obj.addcon = info_data.add_daily.addcon_new;
                obj.addecon = info_data.add_daily.addecon_new;
                obj.addcure = info_data.add_daily.addcure_new;
                obj.adddeath = info_data.add_daily.adddeath_new;
                obj.addhecon = info_data.add_daily.addhecon_new;
                obj.wjw = info_data.add_daily.wjw_addsus_new;
                // console.log("obj",obj);
                // that.dataList = obj;
                that.setData({
                    dataList : obj
                })
                // console.log('dataList',that.dataList);
             },
             fail(error){
                 console.log("请求失败");
             }
        })
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
       this.getNum();
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {
        // this.getNum();
    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})